package b3.widget.store
{
	import b3.config.*;
	import b3.net.*;
	import b3.util.*;
	import b3.widget.*;
	import b3.widget.basic.*;
	
	import flash.display.Sprite;
	import flash.filters.*;
	import flash.text.*;

	public class StoreItemMessage extends Sprite
	{
		public function StoreItemMessage(objectIndex:int)
		{
			super();
			var objectConfig:ObjConfig = Config.objConfigs[objectIndex];
			var roundRecContainer:Sprite = new Sprite();
			//名字
			var nameText:TextField = new TextField();
			nameText.selectable = false;
        	nameText.autoSize = TextFieldAutoSize.LEFT;
			nameText.defaultTextFormat = new TextFormat("微软雅黑", 15, 0x000000, true);
//			nameText.filters = [new GlowFilter(0x55CC00, 1, 1.3, 1.3, 100, BitmapFilterQuality.HIGH)];
			
			//具体信息
			var tipText:TextField = new TextField();
			tipText.selectable = false;
        	tipText.autoSize = TextFieldAutoSize.LEFT;
        	tipText.width = 180;
        	tipText.wordWrap = true;
			tipText.multiline = true;
			tipText.defaultTextFormat = new TextFormat("微软雅黑", 13, 0x000000, true);
			
			if (objectConfig.notOnSale)
			{
				tipText.htmlText = "<i>非卖品</i>";
			}
			else if (objectConfig.priceGoldIngot > 0)
			{
				tipText.htmlText = "<i>神马元宝: " + objectConfig.priceGoldIngot + "</i>";
			}
			else if (objectConfig.priceGoldCoin > 0)
			{
				tipText.htmlText = "<i>金币: " + objectConfig.priceGoldCoin + "</i>";
			}
			else if (objectConfig.priceLight > 0)
			{
				tipText.htmlText = "<i>光明币: " + objectConfig.priceLight + "</i>";
			}
			else
			{
				tipText.htmlText = "<i>黑暗币: " + objectConfig.priceDark + "</i>";
			}

			nameText.text = objectConfig.name.toString();
			tipText.htmlText += "作用: " + objectConfig.description;
			if (objectConfig.direction.length > 0)
				tipText.htmlText += "<font size='12'>（" + objectConfig.direction + "）</font>";
			tipText.y = 20;
			
			roundRecContainer.addChild(nameText);
			roundRecContainer.addChild(tipText);

			var rrect:Sprite = new Sprite();
			rrect.graphics.lineStyle(2, 0xFFFFFF);
			rrect.graphics.beginFill(0x88FF33);
			rrect.graphics.drawRoundRect(0, 0, 210, roundRecContainer.height + 30, 15, 15);
			rrect.graphics.endFill();
			rrect.alpha = 0.8;
			addChild(rrect);
			roundRecContainer.x = 10;
			roundRecContainer.y = 10;
			addChild(roundRecContainer);
		}
		
		private function getFightPoint(fp:int):Sprite
		{
			var fpContainer:Sprite = new Sprite();
			//战力图标
			var CampIcon:Class = ResourceHelper.getInstance().getClassByName("CampIcon");
			var fpIcon:Sprite = new CampIcon();
			fpIcon.width = 20;
			fpIcon.height = 20;
			fpContainer.addChild(fpIcon);
			//坦克战力
			var fightPoint:TextField = new TextField();
			fightPoint.selectable = false;
        	fightPoint.autoSize = TextFieldAutoSize.LEFT;
			fightPoint.defaultTextFormat = new TextFormat("微软雅黑", 12, 0xFFFFFF);
			fightPoint.filters = [new GlowFilter(0x000000, 1, 1.3, 1.3, 100, BitmapFilterQuality.HIGH)];
			fightPoint.text = fp.toString();
			fightPoint.x = 25;
			fpContainer.addChild(fightPoint);
			return fpContainer;
		}
		
	}
}